Skip to content

Make proxy URL optional configurable option in external-links HTML validation rule - #166

Merged
fulldecent merged 6 commits into
mainfrom
copilot/fix-99a38ce5-7421-4680-9b8b-bb5c47f9070f
Sep 16, 2025
Merged

Make proxy URL optional configurable option in external-links HTML validation rule#166
fulldecent merged 6 commits into
mainfrom
copilot/fix-99a38ce5-7421-4680-9b8b-bb5c47f9070f

Conversation

Copilot AI commented Sep 15, 2025

Copy link
Copy Markdown
Contributor

Successfully updated branch with latest changes from main and fixed linting errors:

  • Analyzed current implementation and feedback comments
  • Remove DEFAULT_PROXY_URL constant from external-links rule
  • Make proxyUrl option optional in the rule schema (based on feedback)
  • Remove proxyUrl from plugin's recommended configuration
  • Update main configuration to keep proxyUrl in user configuration
  • Update logic to handle optional proxy URL properly
  • Test changes to ensure they work properly
  • Reply to feedback comments
  • Merge latest changes from main branch
  • Fix linting errors using yarn lint-fix

Changes Made

  1. Removed DEFAULT_PROXY_URL constant from test/plugin.html-validate.external-links.mjs
  2. Updated constructor to use options?.proxyUrl directly without fallback to default
  3. Made proxyUrl optional in the rule schema (removed required: true)
  4. Removed proxy URL from plugin's recommended configuration in test/plugin.html-validate.mjs
  5. Updated condition logic from this.proxyUrl !== null to this.proxyUrl to handle undefined values
  6. Kept proxy URL in main configuration (.htmlvalidate.mjs) as user configuration
  7. Merged latest changes from main branch including PR Replace dirty words checker with allowed-links rule #163 updates
  8. Fixed linting errors by removing extra blank lines using yarn lint-fix

Behavior

  • When proxyUrl is specified: Uses proxy server for external link checking
  • When proxyUrl is not specified: Falls back to direct link checking (original behavior)
  • Plugin itself: Contains no hardcoded URLs and requires explicit user configuration
  • Branch is now up-to-date with latest main branch changes
  • Code follows proper formatting standards as verified by Prettier

The plugin now properly supports optional proxy URL configuration while maintaining backward compatibility with the original behavior when no proxy is specified. All tests pass successfully and code formatting is correct.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com>
Copilot AI changed the title [WIP] Do this @fulldecent/github-pages-template/issues/165 Move proxy URL to rule option in external-links HTML validation rule Sep 15, 2025
Copilot AI requested a review from fulldecent September 15, 2025 21:04

@fulldecent fulldecent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please fix these and also test

// Status code 500 is returned if the server is down or timeout.
const PROXY_URL = "https://api.PacificMedicalTraining.com/public/link-check/status";
// Default proxy URL if none is provided via options
const DEFAULT_PROXY_URL = "https://api.PacificMedicalTraining.com/public/link-check/status";

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot the plugin should not have a default URL.

That should only be configured when /using/ the plugin

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! Removed the DEFAULT_PROXY_URL constant from the external-links plugin. The plugin now requires users to configure the proxy URL via the options parameter. (53059af)

Comment thread test/plugin.html-validate.mjs Outdated
rules: {
"pacific-medical-training/mailto-awesome": "error",
"pacific-medical-training/external-links": "error",
"pacific-medical-training/external-links": [

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin should not specify the URL.

The user of the plugin should specify the URL

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! Removed the proxy URL configuration from the plugin's recommended config. Users must now explicitly specify the proxy URL when using the external-links rule. (53059af)

…onfig

Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com>

Copilot AI commented Sep 16, 2025

Copy link
Copy Markdown
Contributor Author

@copilot please fix these and also test

Fixed both issues and tested successfully. The plugin no longer has any default proxy URL - users must explicitly configure it. All tests pass. (53059af)

Copilot AI changed the title Move proxy URL to rule option in external-links HTML validation rule Make proxy URL required option in external-links HTML validation rule Sep 16, 2025
Copilot AI requested a review from fulldecent September 16, 2025 18:33

@fulldecent fulldecent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot fix please

type: "string",
description:
"URL of proxy server to check external links. Must accept a query parameter 'url' and return the status code and possibly location: header in the response.",
required: true,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this option is NOT required.

if it is unspecified then the proxy server is not used, as was the case before you started working on this branch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! Removed the required: true from the proxyUrl option and updated the logic to properly handle when no proxy URL is specified. The rule now falls back to direct link checking when proxyUrl is not provided, matching the original behavior. (e0424b5)

Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com>

Copilot AI commented Sep 16, 2025

Copy link
Copy Markdown
Contributor Author

@copilot fix please

Fixed! Made the proxyUrl option optional instead of required. When no proxy URL is specified, the rule falls back to direct link checking as it did originally. All tests pass. (e0424b5)

Copilot AI changed the title Make proxy URL required option in external-links HTML validation rule Make proxy URL optional configurable option in external-links HTML validation rule Sep 16, 2025
Copilot AI requested a review from fulldecent September 16, 2025 19:04
@fulldecent
fulldecent marked this pull request as ready for review September 16, 2025 19:29
@fulldecent

Copy link
Copy Markdown
Owner

@copilot rebase and squash

Copilot AI commented Sep 16, 2025

Copy link
Copy Markdown
Contributor Author

@copilot rebase and squash

I cannot perform rebase and squash operations as I don't have access to force push capabilities. The commits currently in the PR show the iterative development process based on your feedback. If you'd like to squash the commits, you'll need to do this manually using git rebase -i or GitHub's squash merge option when merging the PR.

@fulldecent

fulldecent commented Sep 16, 2025

Copy link
Copy Markdown
Owner

@copilot OK, well figure out how to incorporate the fixes in your upstream branch then

@fulldecent

Copy link
Copy Markdown
Owner

@copilot YOU GO and fix your commit. go get new things from upstream main branch

Copilot AI commented Sep 16, 2025

Copy link
Copy Markdown
Contributor Author

@copilot YOU GO and fix your commit. go get new things from upstream main branch

Fixed! Successfully merged the latest changes from the upstream main branch. The branch is now up-to-date with all recent changes including PR #163. All tests pass. (4841f34)

@fulldecent

Copy link
Copy Markdown
Owner

@copilot fix your linting error, use yarn lint-fix

Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com>

Copilot AI commented Sep 16, 2025

Copy link
Copy Markdown
Contributor Author

@copilot fix your linting error, use yarn lint-fix

Fixed! Ran yarn lint-fix to resolve linting errors in the external-links plugin. Removed extra blank lines to meet Prettier formatting standards. All tests pass. (d63a478)

@fulldecent
fulldecent merged commit b58991f into main Sep 16, 2025
5 checks passed
@fulldecent
fulldecent deleted the copilot/fix-99a38ce5-7421-4680-9b8b-bb5c47f9070f branch September 16, 2025 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants